<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试接口调试</title>
    <script src="js/jquery.min.js"></script>
</head>
<body>
<script>

    $(function(){
        var date = {
            "sourceCode":"webSite",
            "token":"5c8b0c20553b43afb7df944cb2f2f30c",
            "givenName":"宝宝",
            "surname":"小",
            "gender":"Male",
            "birthday":"2017-04-12",
            "birthCertificate":"1",
            "immunizationRecord":"1",
            "healthStatus":"123",
            "birthCert":"123",
            "socialSecurityNum":"123",
            "kidney":"123",
            "allergicHistory":"123",
            "familyAddr":"123",
            "postcode":"123",
            "telephone":"123",
            "parentPhone":"123",
            "propertyCertificateNum":"123",
            "electronicMessage":"123",
            "residence":"123",
            "residencePostcode":"123",
            "familyMembers":[{"familyRelation":"父亲","name":"老王","addr":"suZ","workUnit":"asd","idNum":"111"},{"familyRelation":"父亲","name":"老王","addr":"suZ","workUnit":"asd","idNum":"111"}]};

    $.ajax({
        type:'post',
        url:"http://118.178.252.68:8080/crm-web/v1/child/add?access-token=5c8b0c20553b43afb7df944cb2f2f30c",
        datatype:'json',
        contentType:'application/json',
        data:JSON.stringify(date),
        success: function(data){
            console.log(data)
            alert(data.returnstatus+'1')
        },
        error:function(data){
            console.log(data)
            alert(data.returnstatus+'2')
        }
    });
    })







//var xhr = new XMLHttpRequest();
//var url ="http://118.178.252.68:8080/crm-web/v1/child/add?access-token=5c8b0c20553b43afb7df944cb2f2f30c";
//var data = JSON.stringify({
//        "sourceCode":"webSite",
//        "token":"5c8b0c20553b43afb7df944cb2f2f30c",
//    "givenName":"宝宝",
//    "surname":"小",
//    "gender":"Male",
//    "birthday":"2017-04-12",
//        "birthCertificate":"1",
//        "immunizationRecord":"1",
//        "healthStatus":"123",
//        "birthCert":"123",
//        "socialSecurityNum":"123",
//        "kidney":"123",
//        "allergicHistory":"123",
//        "familyAddr":"123",
//        "postcode":"123",
//        "telephone":"123",
//        "parentPhone":"123",
//        "propertyCertificateNum":"123",
//        "electronicMessage":"123",
//        "residence":"123",
//        "residencePostcode":"123",
//    "familyMembers":[{"familyRelation":"父亲","name":"老王","addr":"suZ","workUnit":"asd","idNum":"111"},{"familyRelation":"父亲","name":"老王","addr":"suZ","workUnit":"asd","idNum":"111"}]});
//xhr.open("POST", url );
//xhr.setRequestHeader('Content-Type','application/json');
//xhr.send(data)
//xhr.onload = function(data){
//    console.log(xhr.responseText)
//}
</script>


</body>
</html>